<template>
    <div class="handle">
        <el-header class="title" style="position: relative;left: 30px;top: 20px;font-size: 30px">
            <i class="el-icon-user-solid">案件信息</i>
        </el-header>
        <el-divider></el-divider>

        <div class="message">
            <div class="bg-purple">案号：<br>{{law.caseNo}}</div>
            <div class="bg-purple">案件类型：<br>{{law.caseTypeName}}</div>
            <div class="bg-purple">委托人：<br>{{law.caseWtr}}</div>
            <div class="bg-purple">案由：<br>{{law.caseCause}}</div>
        </div>

        <div class="form" style="margin-left: 20px;margin-top: 30px">
            <el-form :model="law" label-width="100px" label-position="top">
                <el-form-item label="结案方式">
                    <el-select v-model="law.caseSettleType" :value="law.caseSettleType" style="width: 500px">
                        <el-option label="选择结案方式" value="0"></el-option>
                        <el-option label="调解" value="1"></el-option>
                        <el-option label="判决" value="2"></el-option>
                        <el-option label="撤诉" value="3"></el-option>
                        <el-option label="其他方式" value="4"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <p style="color: red">
                        结案后该案件将不允许修改以下内容：案件内容、付款方式、电子档案、费用减免申请；
                        请在结案前，把以上禁止修改的内容补充齐全。
                    </p>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleSubmitForm">确定提交</el-button>
                    <el-button @click="goBack">返回</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
    import CaseLawService from '../../../model/gs/CaseLawService.js'
    const caseLawService = CaseLawService.getInstance()

    export default {
        props:['law','active'],
        data() {
            return {}
        },
        methods:{
            handleSubmitForm(){
                if(this.law.caseSettleType == 0 || this.law.caseSettleType == null){
                    this.$message.warning({
                        message:'请选择结案方式',
                        duration:1000
                    })
                    return
                }
                caseLawService.caseClose(this.law).then(response => {
                    if(response.data.code === 0){
                        this.$message.success({
                            message:'结案申请成功',
                            duration:1000
                        })
                        this.$emit('completed')
                    }
                })
            },
            goBack(){
                this.$emit('back')
            }
        }
    }
</script>

<style scoped>
    .handle{
        width: 100%;
    }
    .message{
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        margin-left: 8px;
    }
    .bg-purple {
        border: 1px solid gainsboro;
        width: 32%;
        padding-top: 15px;
        height: 70px;
        padding-left: 10px;
    }
    .form{
        width: 100%;
    }
</style>